package com.zigong.app.ui.adapter.holder;

import android.content.Context;
import android.view.View;

import com.ruihang.generalibrary.ui.adapter.holder.BaseRecylerHolder;
import com.ruihang.generalibrary.ui.util.OnItemInternalClick;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.zigong.app.R;
import com.zigong.app.beans.SearchKeyWords;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/6/28 0028.
 */

public class SearchHistoryHolder extends BaseRecylerHolder<SearchKeyWords> {

    @BindView(R.id.item_search_history)
    protected CustomFontTextView search_history;

    public SearchHistoryHolder(Context context, View itemView) {
        super(context, itemView);
        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                clidk(v);
            }
        });
    }

    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(SearchKeyWords searchKeyWords) {
        search_history.setText(searchKeyWords.getKeywords());
    }

    @Override
    public void setData(SearchKeyWords searchKeyWords, int position, boolean isSelected) {
        super.setData(searchKeyWords, position, isSelected);
    }

    @Override
    public SearchHistoryHolder setInternalClick(OnItemInternalClick internalClick) {
        super.setInternalClick(internalClick);
        return this;
    }

    private void clidk(View v) {
        if (internalClick != null) {
            internalClick.onItemInternalClick(itemView, v, getAdapterPosition());
        }
    }
}
